//	---------------------------------------------------------------------------
//	dark-matter-data
//	Copyright (c) 2014 dark-matter-data committers
//	---------------------------------------------------------------------------
//	This program is free software; you can redistribute it and/or modify it
//	under the terms of the GNU Lesser General Public License as published by the
//	Free Software Foundation; either version 3 of the License, or (at your
//	option) any later version.
//	This program is distributed in the hope that it will be useful, but WITHOUT
//	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
//	more details.
//	You should have received a copy of the GNU Lesser General Public License along
//	with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
//	---------------------------------------------------------------------------
package org.dmd.gpb.tools.protoparsing.generated.dmw;

// Generated from: org.dmd.util.codegen.ImportManager.getFormattedImports(ImportManager.java:82)
// Called from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:442)
import java.util.ArrayList;                                                              // To support getMVCopy() - (BaseDMWGenerator.java:1181)
import java.util.Iterator;                                                               // Support copy of MV objects - (BaseDMWGenerator.java:2240)
import org.dmd.dmc.*;                                                                    // If any attributes - (BaseDMWGenerator.java:1087)
import org.dmd.dmc.definitions.DmcDefinitionIF;                                          // The object is a domain specific definition - (BaseDMWGenerator.java:411)
import org.dmd.dmc.types.DefinitionName;                                                 // Is named by - (BaseDMWGenerator.java:1062)
import org.dmd.dms.ClassDefinition;                                                      // Passing derived class def up the hierarchy - (BaseDMWGenerator.java:1067)
import org.dmd.dms.generated.dmo.MetaDMSAG;                                              // Required for MODREC constructor - (BaseDMWGenerator.java:1072)
import org.dmd.dms.generated.dmw.StringIterableDMW;                                      // For multi-valued String - (BaseDMWGenerator.java:2103)
import org.dmd.dms.generated.types.DmcTypeModifierMV;                                    // Required for MODREC constructor - (BaseDMWGenerator.java:1071)
import org.dmd.gpb.tools.protoparsing.extended.ProtoDefinition;                          // Derived class - (BaseDMWGenerator.java:1248)
import org.dmd.gpb.tools.protoparsing.extended.ProtoField;                               // Is reference type - (BaseDMWGenerator.java:1107)
import org.dmd.gpb.tools.protoparsing.extended.ProtoFile;                                // Required for getModificationRecorder() - (BaseDMWGenerator.java:1076)
import org.dmd.gpb.tools.protoparsing.extended.ProtoMainElement;                         // Is reference type - (BaseDMWGenerator.java:1107)
import org.dmd.gpb.tools.protoparsing.generated.dmo.DmdprotoDMSAG;                       // Attribute embeddedElements from the dmdproto schema - (BaseDMWGenerator.java:897)
import org.dmd.gpb.tools.protoparsing.generated.dmo.ProtoFieldDMO;                       // For multi-valued adds of ProtoField - (BaseDMWGenerator.java:1767)
import org.dmd.gpb.tools.protoparsing.generated.dmo.ProtoFileDMO;                        // Class not auxiliary or abstract - (BaseDMWGenerator.java:1252)
import org.dmd.gpb.tools.protoparsing.generated.dmo.ProtoMainElementDMO;                 // For multi-valued adds of ProtoMainElement - (BaseDMWGenerator.java:1767)
import org.dmd.gpb.tools.protoparsing.generated.dmw.ProtoFieldIterableDMW;               // For multi-valued ProtoField - (BaseDMWGenerator.java:1709)
import org.dmd.gpb.tools.protoparsing.generated.dmw.ProtoMainElementIterableDMW;         // For multi-valued ProtoMainElement - (BaseDMWGenerator.java:1709)



/**
 * The ProtoFile is used to represent a single .proto file. It may be
 * parsed\n from an existing .proto file by the GpbDotProtoParser utility.
 * <P>
 * Generated from the dmdproto schema at version unknown
 * <P>
 * This code was auto-generated by the dmggenerator utility and shouldn't be alterred manually!
 * Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:479)
 */
abstract public class ProtoFileDMW extends ProtoDefinition implements DmcDefinitionIF, DmcNamedObjectIF {

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:558)
    public ProtoFileDMW() {
        super(new ProtoFileDMO(), org.dmd.gpb.tools.protoparsing.generated.DmdprotoSchemaAG._ProtoFile);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:564)
    public ProtoFileDMW(DmcTypeModifierMV mods) {
        super(new ProtoFileDMO(mods), org.dmd.gpb.tools.protoparsing.generated.DmdprotoSchemaAG._ProtoFile);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:606)
    public ProtoFile getModificationRecorder(){
        ProtoFile rc = new ProtoFile();
        rc.setName(getName());
        rc.setModifier(new DmcTypeModifierMV(MetaDMSAG.__modify));
        return(rc);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:627)
    public ProtoFileDMW(ProtoFileDMO obj) {
        super(obj, org.dmd.gpb.tools.protoparsing.generated.DmdprotoSchemaAG._ProtoFile);
    }

    public ProtoFile cloneIt() {
        ProtoFile rc = new ProtoFile();
        rc.setDmcObject(getDMO().cloneIt());
        return(rc);
    }

    public ProtoFileDMO getDMO() {
        return((ProtoFileDMO) core);
    }

    // Generated from: org.dmd.dmg.generators.BaseDMWGenerator.dumpWrapper(BaseDMWGenerator.java:642)
    protected ProtoFileDMW(ProtoFileDMO obj, ClassDefinition cd) {
        super(obj,cd);
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.getAccessFunctions(BaseDMWGenerator.java:1297)
    public DefinitionName getObjectName(){
        return(((ProtoFileDMO) core).getName());
    }

    public int hashCode(){
        return(getObjectName().hashCode());
    }

    public DmcAttribute<?> getObjectNameAttribute(){
        return(((ProtoFileDMO) core).getObjectNameAttribute());
    }

    public boolean equals(Object obj){
        if (obj instanceof ProtoFileDMW){
            return( getObjectName().equals( ((ProtoFileDMW) obj).getObjectName()) );
        }
        return(false);
    }

    /**
     * @return The number of ProtoMainElement items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1671)
    public int getEmbeddedElementsSize(){
        return(((ProtoFileDMO) core).getEmbeddedElementsSize());
    }

    /**
     * @return true if there are no ProtoMainElementDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1679)
    public boolean getEmbeddedElementsIsEmpty(){
        if (((ProtoFileDMO) core).getEmbeddedElementsSize() == 0)
            return(true);
        return(false);
    }

    /**
     * @return true if there are any ProtoMainElementDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1689)
    public boolean getEmbeddedElementsHasValue(){
        if (((ProtoFileDMO) core).getEmbeddedElementsSize() == 0)
            return(false);
        return(true);
    }

    /**
     * @return An Iterator of ProtoMainElementDMO objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1716)
    public ProtoMainElementIterableDMW getEmbeddedElementsIterable(){
        DmcAttribute<?> attr = core.get(DmdprotoDMSAG.__embeddedElements);
        if (attr == null)
            return(ProtoMainElementIterableDMW.emptyList);
        
        return(new ProtoMainElementIterableDMW(((ProtoFileDMO) core).getEmbeddedElements()));
    }

    /**
     * Adds another embeddedElements value.
     * @param value A value compatible with ProtoMainElement
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1773)
    public DmcAttribute<?> addEmbeddedElements(ProtoMainElement value){
        DmcAttribute<?> attr = ((ProtoFileDMO) core).addEmbeddedElements(((ProtoMainElementDMO)value.getDmcObject()));
        return(attr);
    }

    /**
     * Deletes a embeddedElements value.
     * @param value The ProtoMainElement to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1823)
    public void delEmbeddedElements(ProtoMainElement value){
        ((ProtoFileDMO) core).delEmbeddedElements(value.getDMO());
    }

    /**
     * @return A COPY of the collection of ProtoMainElement objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1887)
    public ArrayList<ProtoMainElement> getEmbeddedElementsCopy(){
        DmcAttribute<?> attr = ((ProtoFileDMO) core).get(DmdprotoDMSAG.__embeddedElements);
        if (attr == null)
            return(new ArrayList<ProtoMainElement>());
        
        ArrayList<ProtoMainElement> rc = new ArrayList<ProtoMainElement>(attr.getMVSize());
        
        ProtoMainElementIterableDMW it = getEmbeddedElementsIterable();
        while(it.hasNext()){
            rc.add(it.next());
        }
        
        return(rc);
    }

    /**
     * Removes the embeddedElements attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2292)
    public void remEmbeddedElements(){
        ((ProtoFileDMO) core).remEmbeddedElements();
    }

    /**
     * @return The number of ProtoField items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1671)
    public int getFieldsSize(){
        return(((ProtoFileDMO) core).getFieldsSize());
    }

    /**
     * @return true if there are no ProtoFieldDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1679)
    public boolean getFieldsIsEmpty(){
        if (((ProtoFileDMO) core).getFieldsSize() == 0)
            return(true);
        return(false);
    }

    /**
     * @return true if there are any ProtoFieldDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1689)
    public boolean getFieldsHasValue(){
        if (((ProtoFileDMO) core).getFieldsSize() == 0)
            return(false);
        return(true);
    }

    /**
     * @return An Iterator of ProtoFieldDMO objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1716)
    public ProtoFieldIterableDMW getFieldsIterable(){
        DmcAttribute<?> attr = core.get(DmdprotoDMSAG.__fields);
        if (attr == null)
            return(ProtoFieldIterableDMW.emptyList);
        
        return(new ProtoFieldIterableDMW(((ProtoFileDMO) core).getFields()));
    }

    /**
     * Adds another fields value.
     * @param value A value compatible with ProtoField
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1773)
    public DmcAttribute<?> addFields(ProtoField value){
        DmcAttribute<?> attr = ((ProtoFileDMO) core).addFields(((ProtoFieldDMO)value.getDmcObject()));
        return(attr);
    }

    /**
     * Deletes a fields value.
     * @param value The ProtoField to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1823)
    public void delFields(ProtoField value){
        ((ProtoFileDMO) core).delFields(value.getDMO());
    }

    /**
     * @return A COPY of the collection of ProtoField objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1887)
    public ArrayList<ProtoField> getFieldsCopy(){
        DmcAttribute<?> attr = ((ProtoFileDMO) core).get(DmdprotoDMSAG.__fields);
        if (attr == null)
            return(new ArrayList<ProtoField>());
        
        ArrayList<ProtoField> rc = new ArrayList<ProtoField>(attr.getMVSize());
        
        ProtoFieldIterableDMW it = getFieldsIterable();
        while(it.hasNext()){
            rc.add(it.next());
        }
        
        return(rc);
    }

    /**
     * Removes the fields attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2292)
    public void remFields(){
        ((ProtoFileDMO) core).remFields();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public String getGeneratedFileName(){
        return(((ProtoFileDMO) core).getGeneratedFileName());
    }

    /**
     * Sets generatedFileName to the specified value.
     * @param value A value compatible with DmcTypeString
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setGeneratedFileName(Object value) throws DmcValueException {
        ((ProtoFileDMO) core).setGeneratedFileName(value);
    }

    /**
     * Sets generatedFileName to the specified value.
     * @param value String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setGeneratedFileName(String value){
        ((ProtoFileDMO) core).setGeneratedFileName(value);
    }

    /**
     * Removes the generatedFileName attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remGeneratedFileName(){
        ((ProtoFileDMO) core).remGeneratedFileName();
    }

    /**
     * @return The number of String items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1671)
    public int getImportSize(){
        return(((ProtoFileDMO) core).getImportSize());
    }

    /**
     * @return true if there are no StringDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1679)
    public boolean getImportIsEmpty(){
        if (((ProtoFileDMO) core).getImportSize() == 0)
            return(true);
        return(false);
    }

    /**
     * @return true if there are any StringDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1689)
    public boolean getImportHasValue(){
        if (((ProtoFileDMO) core).getImportSize() == 0)
            return(false);
        return(true);
    }

    /**
     * @return An Iterator of String objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2107)
    public StringIterableDMW getImportIterable(){
        DmcAttribute<?> attr = core.get(DmdprotoDMSAG.__import);
        if (attr == null)
            return(StringIterableDMW.emptyList);
        
        return(new StringIterableDMW(((ProtoFileDMO) core).getImport()));
    }

    /**
     * Adds another import value.
     * @param value A value compatible with String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2133)
    public void addImport(Object value) throws DmcValueException {
        ((ProtoFileDMO) core).addImport(value);
    }

    /**
     * Adds another import value.
     * @param value A value compatible with String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2143)
    public void addImport(String value){
        ((ProtoFileDMO) core).addImport(value);
    }

    /**
     * Returns true if the collection contains the import value.
     * @param value A value compatible with String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2200)
    public boolean importContains(String value){
        return(((ProtoFileDMO) core).importContains(value));
    }

    /**
     * @return A COPY of the collection of String objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2244)
    @SuppressWarnings("unchecked")
    public ArrayList<String> getImportCopy(){
        DmcAttribute<?> attr = core.get(DmdprotoDMSAG.__import);
        if (attr == null)
            return(new ArrayList<String>());
        
        ArrayList<String> rc = new ArrayList<String>(attr.getMVSize());
        
        Iterator<String> it = (Iterator<String>) attr.getMV();
        while(it.hasNext()){
            rc.add(it.next());
        }
        
        return(rc);
    }

    /**
     * Deletes a import value.
     * @param value The String to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2271)
    public void delImport(Object value) throws DmcValueException {
        ((ProtoFileDMO) core).delImport(value);
    }

    /**
     * Deletes a import value.
     * @param value The String to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2280)
    public void delImport(String value){
        ((ProtoFileDMO) core).delImport(value);
    }

    /**
     * Removes the import attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2292)
    public void remImport(){
        ((ProtoFileDMO) core).remImport();
    }

    /**
     * @return The number of ProtoMainElement items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1671)
    public int getMainElementsSize(){
        return(((ProtoFileDMO) core).getMainElementsSize());
    }

    /**
     * @return true if there are no ProtoMainElementDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1679)
    public boolean getMainElementsIsEmpty(){
        if (((ProtoFileDMO) core).getMainElementsSize() == 0)
            return(true);
        return(false);
    }

    /**
     * @return true if there are any ProtoMainElementDMO items.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1689)
    public boolean getMainElementsHasValue(){
        if (((ProtoFileDMO) core).getMainElementsSize() == 0)
            return(false);
        return(true);
    }

    /**
     * @return An Iterator of ProtoMainElementDMO objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1716)
    public ProtoMainElementIterableDMW getMainElementsIterable(){
        DmcAttribute<?> attr = core.get(DmdprotoDMSAG.__mainElements);
        if (attr == null)
            return(ProtoMainElementIterableDMW.emptyList);
        
        return(new ProtoMainElementIterableDMW(((ProtoFileDMO) core).getMainElements()));
    }

    /**
     * Adds another mainElements value.
     * @param value A value compatible with ProtoMainElement
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1773)
    public DmcAttribute<?> addMainElements(ProtoMainElement value){
        DmcAttribute<?> attr = ((ProtoFileDMO) core).addMainElements(((ProtoMainElementDMO)value.getDmcObject()));
        return(attr);
    }

    /**
     * Deletes a mainElements value.
     * @param value The ProtoMainElement to be deleted from set of attribute values.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1823)
    public void delMainElements(ProtoMainElement value){
        ((ProtoFileDMO) core).delMainElements(value.getDMO());
    }

    /**
     * @return A COPY of the collection of ProtoMainElement objects.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:1887)
    public ArrayList<ProtoMainElement> getMainElementsCopy(){
        DmcAttribute<?> attr = ((ProtoFileDMO) core).get(DmdprotoDMSAG.__mainElements);
        if (attr == null)
            return(new ArrayList<ProtoMainElement>());
        
        ArrayList<ProtoMainElement> rc = new ArrayList<ProtoMainElement>(attr.getMVSize());
        
        ProtoMainElementIterableDMW it = getMainElementsIterable();
        while(it.hasNext()){
            rc.add(it.next());
        }
        
        return(rc);
    }

    /**
     * Removes the mainElements attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatMV(BaseDMWGenerator.java:2292)
    public void remMainElements(){
        ((ProtoFileDMO) core).remMainElements();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public DefinitionName getName(){
        return(((ProtoFileDMO) core).getName());
    }

    /**
     * Sets name to the specified value.
     * @param value A value compatible with DmcTypeDefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setName(Object value) throws DmcValueException {
        ((ProtoFileDMO) core).setName(value);
    }

    /**
     * Sets name to the specified value.
     * @param value DefinitionName
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setName(DefinitionName value){
        ((ProtoFileDMO) core).setName(value);
    }

    /**
     * Removes the name attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remName(){
        ((ProtoFileDMO) core).remName();
    }

    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1474)
    public String getPackage(){
        return(((ProtoFileDMO) core).getPackage());
    }

    /**
     * Sets package to the specified value.
     * @param value A value compatible with DmcTypeString
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1584)
    public void setPackage(Object value) throws DmcValueException {
        ((ProtoFileDMO) core).setPackage(value);
    }

    /**
     * Sets package to the specified value.
     * @param value String
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1593)
    public void setPackage(String value){
        ((ProtoFileDMO) core).setPackage(value);
    }

    /**
     * Removes the package attribute value.
     */
    // org.dmd.dmg.generators.BaseDMWGenerator.formatSV(BaseDMWGenerator.java:1619)
    public void remPackage(){
        ((ProtoFileDMO) core).remPackage();
    }


}
